package comp9417;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;


/**
 * Created by huy on 20/05/14.
 */
public class DataLoader {

    public Dataset loadClassificationData(String fileName) throws FileNotFoundException {
        Scanner scanner = new Scanner(new File(fileName));
        Loader loader = new ARFFLoader(scanner);
        Dataset dataset = loader.load();
        pruneAttributes(dataset);
        scanner.close();
        return dataset;
    }


    private void pruneAttributes(Dataset dataset) {
        for (Attribute attribute : dataset.getAttributes()) {
            attribute.type.prune(attribute);
        }
    }
}
